﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;


/// <summary>
/// TAdCustomerLinkman 的摘要说明
/// </summary>
public class TAdCustomerLinkman:TData
{
    const string CTableName = "t_ad_customer_linkman";//表名
    const string CKeyName = "man_id";//主键名

	public TAdCustomerLinkman()
	{
        FTableName = CTableName;
        FKeyName = CKeyName;
	}
    public TAdCustomerLinkman(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }
    #region 表中字段
    private string FManId;

    public string ManId
    {
        get { return FManId; }
        set { FManId = value; }
    }
    private string FCustomerId;

    public string CustomerId
    {
        get { return FCustomerId; }
        set { FCustomerId = value; }
    }
    private string FName;

    public string Name
    {
        get { return FName; }
        set { FName = value; }
    }
    private string FSex;

    public string Sex
    {
        get { return FSex; }
        set { FSex = value; }
    }
    private string FTel;

    public string Tel
    {
        get { return FTel; }
        set { FTel = value; }
    }
    private string FMobile;

    public string Mobile
    {
        get { return FMobile; }
        set { FMobile = value; }
    }
    private string FFax;

    public string Fax
    {
        get { return FFax; }
        set { FFax = value; }
    }
    private string FEmail;

    public string Email
    {
        get { return FEmail; }
        set { FEmail = value; }
    }
    private string FDeptName;

    public string DeptName
    {
        get { return FDeptName; }
        set { FDeptName = value; }
    }
    private string FJob;

    public string Job
    {
        get { return FJob; }
        set { FJob = value; }
    }

    private DateTime FBirthday;

    public DateTime Birthday
    {
        get { return FBirthday; }
        set { FBirthday = value; }
    }
    private string FImAccount;

    public string ImAccount
    {
        get { return FImAccount; }
        set { FImAccount = value; }
    }
    private string FNotice;

    public string Notice
    {
        get { return FNotice; }
        set { FNotice = value; }
    }
    private string FInputer;

    public string Inputer
    {
        get { return FInputer; }
        set { FInputer = value; }
    }
    private DateTime FInputTime;

    public DateTime InputTime
    {
        get { return FInputTime; }
        set { FInputTime = value; }
    }
    #endregion
    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {

            FManId = oDB["man_id"].ToString();
            FCustomerId = oDB["customer_id"].ToString();
            FName = oDB["name"].ToString();
            FSex = oDB["sex"].ToString();
            FTel = oDB["tel"].ToString();
            FMobile = oDB["mobile"].ToString();
            FFax = oDB["fax"].ToString();
            FEmail = oDB["email"].ToString();
            FDeptName = oDB["dept_name"].ToString();
            FJob = oDB["job"].ToString();
            FBirthday = oDB["birthday"].ToDateTime();
            FImAccount = oDB["im_account"].ToString();
            FNotice = oDB["notice"].ToString();
            FInputer = oDB["inputer"].ToString();
            FInputTime = oDB["input_time"].ToDateTime();
        }
        oDB.Free();
    }

    //插入新记录。
    public void Insert()
    {
        string ExSql = "'" + FManId + "','" + FCustomerId + "','" + FName + "','" + FSex + "','" + FTel + "','" + FMobile + "','" + FFax + "','" + FEmail + "','" + FDeptName + "','" + FJob + "','" + FBirthday + "','" + FImAccount + "','" + FNotice + "','" + FInputer + "','" + FInputTime + "'";
        base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
        string ExSql = " customer_id ='" + FCustomerId + "', name ='" + FName + "', sex ='" + FSex + "',  tel='" + FTel + "', mobile ='" + FMobile + "', fax ='" + FFax + "', email ='" + FEmail + "', dept_name ='" + FDeptName + "', job ='" + FJob + "', birthday ='" + FBirthday + "', im_account ='" + FImAccount + "', notice ='" + FNotice + "', inputer ='" + FInputer + "', input_time ='" + FInputTime + "'";
        base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }
}
